package com.doraro.platform.module.device.model.param;

import com.doraro.platform.common.beans.Convert;
import com.doraro.platform.common.beans.params.ValidateGroups;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.PastOrPresent;
import java.time.LocalDate;

@Data
@EqualsAndHashCode(callSuper = false)
public class RepairDeviceParam extends Convert {

    @NotNull(message = "故障设备编号不能为空", groups = ValidateGroups.Create.class)
    @ApiModelProperty(value = "故障设备编号")
    private String deviceId;
    @NotBlank(message = "故障设备不能为空", groups = ValidateGroups.Create.class)
    @ApiModelProperty(value = "故障设备名称")
    private String name;
    @ApiModelProperty(value = "故障设备分类")
    @NotBlank(message = "故障设备分类不能为空", groups = ValidateGroups.Create.class)
    private String type;
    @NotBlank(message = "故障描述不能为空", groups = ValidateGroups.Create.class)
    @ApiModelProperty(value = "故障描述")
    private String detail;
    @NotNull(message = "故障时间不能为空", groups = {
            ValidateGroups.Create.class
            , ValidateGroups.Update.class
    })
    @PastOrPresent(message = "故障时间不能为未来的时间", groups = {
            ValidateGroups.Create.class
            , ValidateGroups.Update.class
    })
    @ApiModelProperty(value = "故障时间", example = "2018-04-11")
    private LocalDate breakdownTime;
    @NotNull(message = "生产时间不能为空", groups = {
            ValidateGroups.Create.class
            , ValidateGroups.Update.class
    })
    @PastOrPresent(message = "生产时间不能为未来的时间", groups = {ValidateGroups.Create.class, ValidateGroups.Update.class})
    @ApiModelProperty(value = "生产时间", example = "2017-04-11")
    private LocalDate productionTime;

}
